<?php

require_once 'Zend/View/Helper/Abstract.php';

class Core_View_Helper_SelectPage extends Zend_View_Helper_Abstract
{
    public function selectPage($name, $value = null, $attribs = null)
    {
        $mdlIndex = new Model_Page();
        $index = $mdlIndex->getIndex(0, 'name');

        $options = array();
        $options[0] = $this->view->getTranslation('Site Root');

        if (is_array($index)) {
            foreach ($index as $id => $page) {
                $options[$id] = $page;
            }
        }
        $form   = new Core_Form();
        $select = $form->createElement('select', $name, array(
            'multiOptions'  => $options,
        ));
        if (is_array($attribs)) {
            $select->setAttribs($attribs);
        }
        return $select;
    }
}